/**
 * @author : andy
 * @description : sse客户端
 */
import ClientManager from "../utils/manager";
import ServerSentEvents from './sse';
export default class SSEClient {
  private manager: ClientManager<ServerSentEvents>;
  constructor () {
    this.manager = new ClientManager();
  }
  create () {
    const sse = new ServerSentEvents();
    this.manager.add(sse);
    return this.manager.get(sse.id) as ServerSentEvents;
  }
  delete (sse: ServerSentEvents) {
    this.manager.delete(sse.id);
  }
  get (id: string) {
    this.manager.get(id);
  }
  clear () {
    this.manager.clear();
  }
  has (id: string) {
    return this.manager.has(id);
  }
}